import Vue from 'vue';

import VueRouter from 'vue-router';

Vue.use(VueRouter);

import Home from './Home.vue';
import OnlineReservation from './OnlineReservation.vue';
import Application from './Application.vue';
import ApplicationResult from './ApplicationResult.vue';
import ScheduleQuery from './ScheduleQuery.vue';
import ReservationQuery from './ReservationQuery.vue';
import QueryResult from './QueryResult.vue';
import CancelReservation from './CancelReservation.vue';
import TakeNumber from './TakeNumber.vue';
import WechatTakeNumber from './WechatTakeNumber.vue';
import QueuingProgress from './QueuingProgress.vue';
import WechatQuerry from './WechatQuerry.vue';
import Guide from './Guide.vue';
import GuideDetail from './GuideDetail.vue';
import Policy from './Policy.vue';
import ApplicationMessage from './ApplicationMessage.vue';
import SpecialApplication from './SpecialApplication.vue';
import SpeApplMsg from './SpeApplMsg.vue';

const router = new VueRouter({
	mode: 'history',
	routes: [
		{
			path: '/',
			component: Home,
		},
		{
			path: '/onlr',
			component: OnlineReservation,
		},
		{
			path: '/appl',
			component: Application,
		},
		{
			path: '/appr',
			component: ApplicationResult,
		},
		{
			path: '/schq',
			component: ScheduleQuery,
		},
		{
			path: '/resq',
			component: ReservationQuery,
		},
		{
			path: '/quer',
			component: QueryResult,
		},
		{
			path: '/canr',
			component: CancelReservation,
		},
		{
			path: '/tnum',
			component: TakeNumber,
		},
		{
			path: '/wtnum',
			component: WechatTakeNumber,
		},
		{
			path: '/qupr',
			component: QueuingProgress,
		},
		{
			path: '/wecq',
			component: WechatQuerry,
		},
		{
			name: 'gui',
			path: '/gui',
			component: Guide,
		},
		{
			path: '/guid',
			name: 'guid',
			component: GuideDetail,
		},
		{
			path: '/poli',
			component: Policy,
		},
		{
			path: '/appm',
			component: ApplicationMessage,
		},
		{
			path: '/spea',
			component: SpecialApplication,
		},
		{
			path: '/samsg',
			component: SpeApplMsg,
		},
	],
});

router.afterEach(route => {
	Vue.nextTick(() => {
		if (typeof document === 'object') {
			document.documentElement.scrollTop = 10;
			document.body.scrollTop = 10;
			setTimeout(() => {
				document.documentElement.scrollTop = 0;
				document.body.scrollTop = 0;
			}, 10);
		}
	});
});

export default router;
